package com.qst.mapreduce.wordcount.mahongsen;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class MaMapper extends Mapper<LongWritable, Text,App,Text> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text,App,Text>.Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] words = line.split(",");
        App app=new App();

        app.setPrice(Double.parseDouble(words[1]));
        app.setTime(words[2]);
        context.write(app,new Text(words[0]));


    }
}
